|
|
|
|
|
|
|
(line 40). FundsAvailabilityDate is set to ten business days from the day the check deposit was made (lines 17 and 18). DepositType captures from the Bank Teller user interface controller class whether the transaction is by cash or by check. TransactionDate captures the date the transaction was made, which would be the current date (at least, for this example). |
|
|
|
|
|
|
|
|
Now notice the new methods: enforceFundsAvailability (starting at line 13) and enforceCashDepositLimit (starting at line 29). The enforceFundsAvailability method sets the date the funds will be available by setting the FundsAvailabilityDate property. The enforceCashDepositLimit method enforces the federal bank regulations regarding cash deposits. The check for these rules and the type of deposit is done immediately upon entering the methods. If the precondition is true, each method will process the rule according to bank or legal specifications. Only one method will be able to process the incoming Deposit object. That's because the deposit transaction can only be of one type, either cash or check. To help you with a deposit type identifier, you have an Enum named eDepositType. |
|
|
|
|
|
|
|
|
LISTING 8.2. THEDepositCLASS. |
|
|
|
 |
|
|
|
|
1: Private mvarAmount As Single 'local copy
2: 'local variable(s) to hold property value(s)
3: Private mvarDepositType As Byte 'local copy
4: 'local variable(s) to hold property value(s)
5: Private mvarFundsAvailabilityDate As Date 'local copy
6: Private mvarTransactionDate As Date 'local copy
7:
8: Public Enum eDepositType
9: Cash
10: Check
11: End Enum
12:
13: Public Function enforceFundsAvailability(argDeposit _
14: As Deposit) As Boolean
15: If DepositType = eDepositType.check Then
16: TransactionDate = Date
17: FundsAvailabilityDate = DateAdd(d, 10, _
18: TransactionDate)
19:
20: MsgBox Funds won't be available until & _
21: CStr(FundsAvailabilityDate)
22:
23: enforceFundsAvailability = True
24: Exit Function
25: End If
26: enforceFundsAvailability = False
27: End Function
28:
|
|
|
|
|
|